<template>
  <div>
    <!-- 顶部导航栏 -->
    <van-nav-bar title="通知" left-arrow @click-left="$router.go(-1)"/>
    <van-list v-model="loading" :finished="finished" finished-text="没有更多了"  @load="onLoad">
        <van-cell v-for="item in matterslist" :key="item.id" @click="detail(item.messageId)">
            <van-cell class="matters" :title="item.title" is-link></van-cell>
            <p class="dataName">{{item.commName}}</p>
        </van-cell>
    </van-list>
  </div>
</template>
<script>
import apiHttp from '../../../../api/index'
import { Toast } from 'vant';
export default {
    data() {
        return {
            loading: false,
            finished: false,
            matterslist: [],
            total:-1,
            page:0
            // userId:sessionStorage.getItem('userId')
        }
    },
    mounted(){},
    methods:{
        
        // 列表
        lists(){
            let parmes = {
                page:this.page,
                pageSize :10,
                userId:1
                // userId:this.userId
            }
            apiHttp.comIndex.getMessageList(parmes,resp=>{
                if(resp.resultCode == '000000'){
                    for(let i = 0; i < resp.data.messageList.length; i++){
                        this.matterslist.push(resp.data.messageList[i])
                    }
                    this.total = resp.data.total
                    this.loading = false
                }else{
                  Toast(resp.resultMsg)
                }
            })
        },
        // 进入页面就执行
        onLoad(){
            if(this.matterslist.length == this.total){
                this.finished  = true
          		this.loading = false 
            }else{
                this.page++
                this.lists()
            }
        },
        // 跳转到详情页
        detail(id){
            this.$router.push({
                path: "/community/ComList/listIntroduction/partyList/onDetails",
                query: { id: id }
            });
        }
    }
}
</script>
<style scoped>
@import "../../../../assets/css/community/listIntroduction/guide.css";
.van-cell::after {
    content: " ";
    position: absolute;
    pointer-events: none;
    box-sizing: border-box;
    left: 15px;
    right: 0;
    bottom: 0;
    -webkit-transform: scaleY(0.5);
    transform: scaleY(0.5);
    border-bottom: 0px solid #ebedf0;
}
.van-cell {
    margin-bottom: 0;
}
.dataName {
    color: #999999;
    font-size: 0.4rem;
    width: 92%;
    margin: 0.2rem auto;
}
</style>

